Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ws): add validation webhooks for Workspace and WorkspaceKind #34

Merged
merged 8 commits into from
Aug 29, 2024

Conversation

Adembc
Copy link

@Adembc Adembc commented Aug 15, 2024

This PR makes the following changes:

  • Re-add cert manager install, It was removed in this PR

Workspace Validations:

  • Reject creation of Workspaces with invalid spec.kind (must reference an existing WorkspaceKind).

WorkspaceKind Validations:

  • Reject updates to spec.podTemplate.options.imageConfig.values[].spec
  • Reject updates to spec.podTemplate.options.podConfig.values[].spec
  • Prevent cycles in options.
  • Only allow removal of option IDs that are not in use.
  • Ensure a default option exists.
  • Ensure that ports in spec.podTemplate.options.imageConfig.values[].spec.ports[].port are unique.
  • Ensure spec.podTemplate.extraEnv[].value is a valid Go template.

Tests:

  • Add unit tests for validating Workspace creation.
  • Add unit tests for validating WorkspaceKind creation.
  • Add unit tests for validating updates to WorkspaceKind.

@Adembc
Copy link
Author

Adembc commented Aug 20, 2024

@thesuperzapper I've added a commit to refactor the ValidateCreate and ValidateUpdate functions in the WorkspaceKind webhook. The refactoring focuses on extracting repeated code into reusable functions and reducing the number of loops to improve efficiency and readability

Adembc and others added 4 commits August 26, 2024 16:30
Signed-off-by: Adem Baccara <[email protected]>
Signed-off-by: Mathew Wicks <[email protected]>
Signed-off-by: Mathew Wicks <[email protected]>
Signed-off-by: Mathew Wicks <[email protected]>
@thesuperzapper
Copy link
Member

@Adembc thanks for your work on this and the rest of GSOC!

I did quite a bit of refactoring in the following commits:

The WorkspaceKind webhook needed a lot of work to make it behave correctly (and detect redirect cycles in a semi-efficient way), and I also made the tests specifically check for each kind of error and added some "success" cases, because otherwise everything might just be failing.

I think this PR should be ready for an initial merge now, there should only be two things left to have a fully working controller, I will raise issues so we can track that work publicly:

  1. Implement the "culling controller"
  2. Adding Istio VirtualService reconciliation to the workspace controller.

/lgtm
/approve

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: thesuperzapper

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit bc4e445 into kubeflow:notebooks-v2 Aug 29, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants